package com.hait.mypicture.model.enmus;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 图片审核状态类
 */
@Getter
public enum PictureReviewStatusEnum {

    REVIEWING("审核中",0),
    PASS("审核通过",1),
    REJECT("拒绝",2);

    private final String text;

    private final int value;

    PictureReviewStatusEnum(String text, int value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据value获取枚举
     * @param value
     * @return
     */
    public static PictureReviewStatusEnum getEnumByValue(Integer value) {
        if (ObjUtil.isEmpty( value)){
            return null;
        }
        for (PictureReviewStatusEnum pictureReviewStatusEnum : PictureReviewStatusEnum.values()) {
            if (pictureReviewStatusEnum.value == value) {
                return pictureReviewStatusEnum;
            }
        }
        return null;
    }
}
